import {http} from "@kit.NetworkKit"

class express_http{

  // http的请求的基础地址。
  private baseUrl:string="http://124.71.106.103:3000";

  constructor(baseUrl:string) {
    this.baseUrl = baseUrl;
  }

  //   get请求的方法
  get(url:string,params:string=""){
    const httpRequest = http.createHttp();

    return httpRequest.request(this.baseUrl+url,{
      extraData:params
    })
  }

  //   post请求的方法
  post(url:string,data:Object){
    const httpRequest = http.createHttp();

    return httpRequest.request(this.baseUrl+url,{
      method:http.RequestMethod.POST,
      header:{
        "content-Type": 'application/json'
      },
      extraData:data
    })
  }



  //   put


  //   delete

  //

}

export default  express_http;